<?php

session_start();
$JO[ "Fashion" ] 		= JO(array(
		"EN"=>"JukeOn™ Fashion",
		"VI"=>"Thời Trang JukeOn™"
	) );
$JO["JO_searchid"] 	 	= JO(array("EN"=>"Search Key",			"VI"=>"Search"	));

$JO[ "rbt" ]		= JO(array("EN"=>"Ring Back Tone",	"VI"=>"Nhạc Chờ"	));
$JO["JO_searchid"] 	= JO(array("EN"=>"Search Key",		"VI"=>"Search"		));

/*if(!isset ($_SESSION["JO_account_key"]) || $_SESSION["JO_account_authority"]!="SO"){

	echo "<script>location='http://jukeon.vn/JO/';</script>";
}*/
$searchkeyartist=$JO["JO_searchid"];
$wherequery="";
if(isset ($_REQUEST["searchkey"])){
    $searchkeyartist=$_REQUEST["searchkey"];
    if($searchkeyartist!=$JO["JO_searchid"]){
        $wherequery= "and artist.`name` like '%".$searchkeyartist."%'";
    }
}
$page=1;
if(isset ($_REQUEST["Page"])){$page=$_REQUEST["Page"];}
if(isset($_GET['key']))
			$key=$_GET['key'];
			else
			$key=661;
?>
<link rel="stylesheet" type="text/css" href="JO_jquery/layout.css" />
<link rel="stylesheet" type="text/css" href="JO_jquery/style6.css" />
<script type="text/javascript" src="JO_jquery/jquery.easing.js"></script>
<script type="text/javascript" src="JO_jquery/script.js"></script>

<script type="text/javascript">
//------------------
function activediv(o){
	document.getElementById('viettel').className='JO_mobile JO_left JO_mobi';
	document.getElementById('mobifone').className='JO_mobile JO_left JO_mobi';
	document.getElementById('vinafone').className='JO_mobile JO_left JO_mobi';
	document.getElementById('sfone').className='JO_mobile JO_left JO_mobi';
	document.getElementById('vietnammobile').className='JO_mobile JO_left JO_mobi';
	document.getElementById('beeline').className='JO_mobile JO_left JO_mobi';
	o.className='JO_mobile JO_left JO_mobi active';
}


//-------------------



$(document).ready( function(){
	var buttons = { previous:$('#lofslidecontent45 .lof-previous') ,
					next:$('#lofslidecontent45 .lof-next') };

	$obj = $('#lofslidecontent45').lofJSidernews( { interval : 4000,
											direction		: 'opacity',
										 	easing			: 'easeOutBounce',
											duration		: 1200,
											auto		 	: true,
											mainWidth:710,
											buttons			: buttons} );
});

window.onload = tuyen_du_lieu('VTL8x88','1',<?=$key?>);

function show_content_rbt(telco,rbt_code){
	var str_temp = "";

	switch (telco) {
	case "VTL8x88":
		if(rbt_code!="")
			str_temp = "Vui lòng soạn tin nhắn <span style='color:red;'><b>BH</b> <b>"+rbt_code+"</b></span> gửi <b style='color:red;'>1221</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, hãy soạn tin <b>DK</b> gửi <b>1221</b> để đăng ký sử dụng dịch vụ nhạc chờ.";
		else
			str_temp = "Vui lòng soạn tin nhắn <span style='color:red;'><b>BH</b> <b>[Mã Nhạc Chờ]</b></span> gửi <b style='color:red;'>1221</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, hãy soạn tin <b>DK</b> gửi <b>1221</b> để đăng ký sử dụng dịch vụ nhạc chờ.";
		break;

	case "VMS8x88":
		if(rbt_code!="")
			str_temp = "Vui lòng soạn tin nhắn <span style='color:red;'><b>CHON</b> <b>"+rbt_code+"</b></span> gửi <b style='color:red;'>9224</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, hãy soạn tin <b>DK</b> gửi <b>9224</b> để đăng ký sử dụng dịch vụ nhạc chờ.";
		else
			str_temp = "Vui lòng soạn tin nhắn <span style='color:red;'><b>CHON</b> <b>[Mã Nhạc Chờ]</b></span> gửi <b style='color:red;'>9224</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, hãy soạn tin <b>DK</b> gửi <b>9224</b> để đăng ký sử dụng dịch vụ nhạc chờ.";
		break;

	case "GPC8x88":
		if(rbt_code!=""){
			str_temp ="-Bước 1: Soạn tin <span style='color:red;'><b>STUNE</b> <b>"+rbt_code+"</b></span> gửi <b style='color:red;'>9194</b>.<br/>";
			str_temp+="-Bước 2: Soạn tin <span style='color:red;'><b>MD</b> <b>"+rbt_code+"</b></span> gửi <b>9194</b>.(5,000 VND/SMS).";
		}
		else{
			str_temp ="-Bước 1: Soạn tin <span style='color:red;'><b>STUNE</b> <b>[Mã Nhạc Chờ]</b></span> gửi <b style='color:red;'>9194</b>.<br/>";
			str_temp+="-Bước 2: Soạn tin <span style='color:red;'><b>MD</b> <b>[Mã Nhạc Chờ]</b></span> gửi <b>9194</b>.(5,000 VND/SMS).";
		}
		break;

	case "VNM8x88":
		if(rbt_code!="")
			str_temp = "Vui lòng soạn tin nhắn <span style='color:red;'><b>MUA</b> <b>"+rbt_code+"</b></span> gửi <b style='color:red;'>2345</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, hãy soạn tin <b>DK HR</b> gửi <b>123</b> để đăng ký sử dụng dịch vụ nhạc chờ.";
		else
			str_temp = "Vui lòng soạn tin nhắn <span style='color:red;'><b>MUA</b> <b>[Mã Nhạc Chờ]</b></span> gửi <b style='color:red;'>2345</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, hãy soạn tin <b>DK HR</b> gửi <b>123</b> để đăng ký sử dụng dịch vụ nhạc chờ.";
		break;

	case "SFN8x88":
		if(rbt_code!="")
			str_temp = "";
		else
			str_temp = "";
		break;

	case "BEE8x88":
		if(rbt_code!="")
			str_temp = "Vui lòng soạn tin nhắn <span style='color:red;'><b>CHON</b> <b>"+rbt_code+"</b></span> gửi <b style='color:red;'>1221</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, hãy soạn tin <b>CHON 1</b> gửi <b>1221</b> để đăng ký sử dụng dịch vụ nhạc chờ.";
		else
			str_temp = "Vui lòng soạn tin nhắn <span style='color:red;'><b>CHON</b> <b>[Mã Nhạc Chờ]</b></span> gửi <b style='color:red;'>1221</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, hãy soạn tin <b>CHON 1</b> gửi <b>1221</b> để đăng ký sử dụng dịch vụ nhạc chờ.";
		break;

	default:
		break;
	}
	str_temp += "";
	str_temp +="<br/><br/>Dịch vụ tìm nhạc chờ:<br/>";
	str_temp +="-Tìm kiếm nhạc chờ theo Tên Bài Hát soạn tin <b>HQ S</b> &lt;<b>Tên Bài Hát</b>&gt; gửi <b>8388</b> (hoặc 8588).<br/>";
	str_temp +="-Tìm kiếm nhạc chờ theo Ca Sĩ soạn tin <b>HQ A</b> &lt;<b>Tên Ca Sĩ</b>&gt; gửi <b>8388</b> (hoặc 8588).<br/>";
	
	return str_temp;
}


function showobj(url,obj) {

	var arr_param 		= url.split("?")[1];
	var str_rbt_code 	= arr_param.split("&")[0].substring(3);
	var str_telco 		= arr_param.split("&")[1].substring(4);
	var str_content		= show_content_rbt(str_telco,str_rbt_code);
	document.getElementById("telco_content").innerHTML= str_content;
	
    document.getElementById(obj).innerHTML="<div style=\"height: 45px;text-align: center;width:100%;background: url(JO_80_image/loading4.gif) center no-repeat\"><br/>Loadding...</div>";
    if (window.XMLHttpRequest) {
    xmlhttp=new XMLHttpRequest(); }
    else {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
        xmlhttp.onreadystatechange=function() {
                if (xmlhttp.readyState==4 && xmlhttp.status==200) {
                    document.getElementById(obj).innerHTML=xmlhttp.responseText;
                }
           };

    xmlhttp.open("GET",url,true);
    xmlhttp.send();
    
}

function tuyen_du_lieu(str,page,art){
	
	if (str==""){
		var str="VTL8x88";
	}

	var str_content	= show_content_rbt(str,"");

	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			document.getElementById("load").innerHTML=xmlhttp.responseText;
			document.getElementById("telco_content").innerHTML= str_content;
		}
	};

	xmlhttp.open("GET","JO_64_ajax.php?tel="+str+"&Page="+page+"&art="+art,true);
	xmlhttp.send();
}
</script>
<script type="text/javascript">
    var musics=new Array();
    var n=0;
</script>

<?
	if(isset ($_REQUEST["key"])){
		$queryimg="Select * from artistimg where `delete` is null and  `artist`='".$_REQUEST["key"]."'";
		$recordSetimg = JO_query( $queryimg );
	}
	if($recordSetimg->num_rows) {
?>

<div class="JO_unit">

	<h1>JukeOn™ Artist</h1>
        
	<div 
		id		= "lofslidecontent45" 
		class	= "unit lof-slidecontent"
		style	= "	width:712px;
					height:110px;"
	>
		<div class="preload">
			<div></div>
		</div>
		<div class="lof-main-outer" style="width:712px; height:110px;">
			<ul class="lof-main-wapper">
			<? while($recordimg = $recordSetimg -> fetch_array( )){?>
				<li>
					<img src="<?=(isset($recordimg["image"])?$recordimg["image"]:"")?>" title="" width="712px" height="110px"/>
				</li>
			<?}?>
			</ul>
		</div>
	</div>
</div>
<?php }else{?>
<div class="JO_page">
	<h1>JukeOn™ Artist</h1>
	<h2>&nbsp;</h2><h3>&nbsp;</h3>
</div>
<?php }?>

<div class="JO_relative" style="width: 960px">
<!--trai-->
		
     <div class="JO_left" style="width: 240px;">
        <div class="JO_box_240" style="margin-top:4px;position: relative;
margin: 4px;
padding: 28px 4px 4px 4px;
width: 222px;">
            <h1 style="margin-top:0px;position: absolute;
margin: 0px;
padding: 0px 0px 0px 8px;
left: -1px;
top: -1px;
width: 224px;
color: #464646 /* 80 */;
font-size: 11px;
font-family: tahoma;
line-height: 24px;

background-color: #EBEBEB;">Artist</h1>
        <table style="width: 100%">
        <tr >
          <td style="text-align:justify;border-bottom: 0px;padding-top:0px;padding-bottom:4px;padding-left:0px;width:240px" class="ds">
            <?php
			$key=$_GET['key'];
			$query= "SELECT * FROM artist LIMIT 20";
			$recordSet = JO_query( $query );
			if( $recordSet -> num_rows ) while( $record = $recordSet -> fetch_array( ) ) {
			
		   ?>
               <div style="width:210px;cursor:pointer" onclick="tuyen_du_lieu('VTL8x88','1',<?=$key?>)"><a href="?JO_unit=61_Rbt&key=<?php echo $record['key'] ?>" onclick="tuyen_du_lieu('VTL8x88','1',<?php echo $key?>)"> <?php echo $record['name'] ?></a> </div>
              <?php 
			}
			
		   ?>
             </td>
        </tr>
      </table>
       </div>
     </div>
     <!--end trai-->
     <!--giua-->
     <!-- artist-->
    <div class="JO_left">
    <div class="JO_bar_480" style="width:460">
            <h1 style="width:462px;margin-bottom:8px"> Artist Information </h1>
            <div style="width:462px;min-height:88px">
              <div style="width:358px;padding-left:0" >
             <?php 
				$key=$_GET['key'];
				$query= "SELECT * FROM artist WHERE `key`=".(isset($_REQUEST["key"])?"$key":"661")." order by name;";
				$recordSet = JO_query( $query );
				if( $recordSet -> num_rows ) $record = $recordSet -> fetch_array( );
	 		?>
          
            <?php echo $record['name'] ?> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Birthday : 00/00/0000<br />
        Autonym 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Nation : KR<br />
        SM Entertainment Co.,LTD
            </div>
            <div style="width:80px;margin:4px 4px 4px 0px;top:0px;position:absolute;right:4px" >
            <img src="JO_81_image_index/110201_02.jpg" width="80px"/>
            </div>
            </div>
    </div>
    <!--end artist-->
    <!--RBT-->
    <div class="JO_bar_480" style="width:460px;margin-top:8px !important">

    	<h1 style="width:462px"> RBT Information </h1>
    	        
        <div 
        	
        	class	="JO_mobile JO_left JO_mobi active"
        	style	="	width		:30px !important;
        				margin-left	:5px;
        				border-right:none;"  				
        	onclick	="tuyen_du_lieu('VTL8x88','1',<?=$key?>);activediv(this);" id="viettel"
        >Viettel</div>
        
        <div 
        	class	="JO_mobile JO_left JO_mobi"
        	onclick	="tuyen_du_lieu('VMS8x88','1',<?=$key?>);activediv(this);"id="mobifone"
        	style	="	width:50px !important;
        				border-right:none"
        >Mobifone</div>
        	
        <div 
        	class	="JO_mobile JO_left JO_mobi"
        	onclick	="tuyen_du_lieu('GPC8x88','1',<?=$key?>);activediv(this);" id="vinafone"
        	style	="	width:50px !important;
        				border-right:none"
        >VinaPhone</div>
        
        <div 
        	class	="JO_mobile JO_left JO_mobi"
        	onclick="tuyen_du_lieu('VNM8x88','1',<?=$key?>);activediv(this);"id="vietnammobile"
        	style	="	width:70px !important;
        				border-right:none;"
        >Vietnammobile</div>
        
        <div 
        	class	="JO_mobile JO_left JO_mobi"
        	onclick	="tuyen_du_lieu('SFN8x88','1',<?=$key?>);activediv(this);"id="sfone"
        	style	="	width:50px !important;
        				border-right:none;
        				border-right:none"
        >Sfone</div>
        
        <div 
        	class	="JO_mobile JO_left JO_mobi"
        	onclick	="tuyen_du_lieu('BEE8x88','1',<?=$key?>);activediv(this);"id="beeline"
        	style	="	width:50px !important;"
        >Beeline</div>
        

        <div class="cleared"></div>

		<div
			id		= "telco_content"
			class	= "JO_bar_480"
			style	= "	width:442px;
						margin:0px 4px 0px 5px;
						padding:4px"
		>	Vui lòng soạn tin nhắn <span style='color:red;'><b>BH</b> <b>[Mã Nhạc Chờ]</b></span> 
			gửi <b style='color:red;'>1221</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, 
			hãy soạn tin <b>DK</b> gửi <b>1221</b> để đăng ký sử dụng dịch vụ nhạc chờ.
		</div>

<div style="margin-top:0;margin-left:4px;width:435px;margin-bottom:0;padding:8px" class="JO_bar_480" id="rbtplayer"><param name="Filename" value="">
     <PARAM NAME="ShowControls" VALUE="-1">
     <PARAM NAME="ShowDisplay" VALUE="0">
     <PARAM NAME="ShowStatusBar" VALUE="-1">
     <PARAM NAME="AutoSize" VALUE="0">
     <param name="AudioStream" value="-1">
     <param name="AutoStart" value="-1">
     <param name="AnimationAtStart" value="-1">
     <param name="AllowScan" value="-1">
     <param name="AllowChangeDisplaySize" value="-1">
     <param name="AutoRewind" value="0">
     <param name="Balance" value="0">
     <param name="BaseURL" value>
     <param name="BufferingTime" value="5">
     <param name="CaptioningID" value>
     <param name="ClickToPlay" value="-1">
     <param name="CursorType" value="0">
     <param name="CurrentPosition" value="-1">
     <param name="CurrentMarker" value="0">
     <param name="DefaultFrame" value>
     <param name="DisplayBackColor" value="0">
     <param name="DisplayForeColor" value="16777215">
     <param name="DisplayMode" value="0">
     <param name="DisplaySize" value="4">
     <param name="Enabled" value="-1">
     <param name="EnableContextMenu" value="-1">
     <param name="EnablePositionControls" value="-1">
     <param name="EnableFullScreenControls" value="0">
     <param name="EnableTracker" value="-1">
     <param name="InvokeURLs" value="-1">
     <param name="Language" value="-1">
     <param name="Mute" value="0">
     <param name="PlayCount" value="1">
     <param name="PreviewMode" value="0">
     <param name="Rate" value="1">
     <param name="SAMILang" value>
     <param name="SAMIStyle" value>
     <param name="SAMIFileName" value>
     <param name="SelectionStart" value="-1">
     <param name="SelectionEnd" value="-1">
     <param name="SendOpenStateChangeEvents" value="-1">
     <param name="SendWarningEvents" value="-1">
     <param name="SendErrorEvents" value="-1">
     <param name="SendKeyboardEvents" value="0">
     <param name="SendMouseClickEvents" value="0">
     <param name="SendMouseMoveEvents" value="0">
     <param name="SendPlayStateChangeEvents" value="-1">
     <param name="ShowCaptioning" value="-1">
     <param name="ShowAudioControls" value="-1">
     <param name="ShowGotoBar" value="0">
     <param name="ShowPositionControls" value="-1">
     <param name="ShowTracker" value="-1">
     <param name="TransparentAtStart" value="0">
     <param name="VideoBorderWidth" value="0">
     <param name="VideoBorderColor" value="0">
     <param name="VideoBorder3D" value="0">
     <param name="Volume" value="-180">
     <param name="WindowlessVideo" value="0">
     <Embed style="z-index:100;margin-bottom:0px !important" type="application/x-mplayer2"
         pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"
         file=""
         src=""
         ShowControls=1
         ShowDisplay=0
         ShowStatusBar=1
         width="434px"
         height="70px">
     </embed></div>
     <div style="width:460px">
     <div style="width:280px;margin-left:0px;float:left;background-color: #EBEBEB;padding:4px 4px 0px 8px;height:24px">Rbt name</div>
     <div style="width:100px;float:left;padding:4px 4px 0px 8px;background-color: #EBEBEB;height:24px">RBT CODE</div>
     <div style="width:36px;float:left;padding:4px 4px 0px 8px;background-color: #EBEBEB;height:24px" >Play</div>
   
     </div>
     
     <div id="load" class="JO_bar_480" style="width:446px;margin-top:0px;margin-left:5px;margin-bottom:20px">
     </div>
    </div>
    <!--end RBT-->
    </div>
     <!--end giua-->
      <!--phai-->
    <div class="JO_left">
    	<div class="JO_box_240" style="width:220px">
        	<h1 style="width:220px"> banner</h1>
        </div>
    </div>
     <!--end phai-->
 <script type="text/javascript">
     function deleteimg(id){
         location = "JO_05_execution.php?JO_query=deleteimg&imgid="+id;
     }
     function changeupload(c){
         
         if(c.checked){
             var ct="<input type=\"file\" name=\"myfiles\" style=\"width: 300px;\"/>";
//             ct+="<input type=\"file\" name=\"myfiles[]\" style=\"width: 300px;\"/>";
//             ct+="<input type=\"file\" name=\"myfiles[]\" style=\"width: 300px;\"/>";
//             ct+="<input type=\"file\" name=\"myfiles[]\" style=\"width: 300px;\"/>";
//             ct+="<input type=\"file\" name=\"myfiles[]\" style=\"width: 300px;\"/>";
             document.getElementById("spimg").innerHTML=ct;
         }else{
             document.getElementById("spimg").innerHTML="<input type=\"text\" id=\"txtimgupload\" name=\"txtimgupload\" style=\"width: 300px;\"/>";
         }
     }
    function addtop(id){

        var contenttop="<span id='trtop_"+id+"'>";
        contenttop+="<table  style='width: 100%;margin: 0px 4px 0px 0px;'>";
        contenttop+="<tr >";
        contenttop+="<td style='width: 50px' id='tdtopid_"+id+"'>"+id+"</td>";
        contenttop+="<td id='tdtop_"+id+"'>"+document.getElementById("td_"+id).innerHTML+"</td>";
        contenttop+="<td style='width: 12px'><a href='#i' onclick='topup("+id+");'><img src='JO_80_image/JO_27_icon_up_on.png' class='JO_icon' alt='Up' title='Up'/></a></td>";
        contenttop+="<td style='width: 12px'><a href='#i' onclick='topdown("+id+");'><img src='JO_80_image/JO_28_icon_down_on.png' class='JO_icon' alt='Down' title='Down'/></a></td>";
        contenttop+="<td style='width: 12px'><a href='#i' onclick='removetop("+id+");'><img src='JO_80_image/JO_23_icon_delete_on.png' class='JO_icon' alt='Remove' title='Remove'/></a></td>";
        contenttop+="</tr>";
        contenttop+="</table>";
        contenttop+="</span>";
        document.getElementById("tb_top_music").innerHTML+=contenttop;

        //alert(document.getElementById("tb_top_music").innerHTML);
        var del = document.getElementById("tr_"+id);
        del.parentNode.removeChild(del);
        musics[n]=id;
        n++;
        //document.getElementById("kqkq").innerHTML=musics;
        create_top();
    }
    function removetop(id){

        var contentmusic="<span id='tr_"+id+"'>";
        contentmusic+="<table style='width: 100%;margin: 0px 4px 0px 0px;' >";
        contentmusic+="<tr ><td id='td_"+id+"'>"+document.getElementById("tdtop_"+id).innerHTML+"</td>";
        contentmusic+="<td style='width:12px'><a href='#i' onclick='addtop("+id+");'><img src='JO_80_image/add_top.png' class='JO_icon' alt='Add To Top Music' title='Add To Top Music'/></a></td>";
        contentmusic+="</tr>";
        contentmusic+="</table>";
        contentmusic+="</span>";
        document.getElementById("tb_music").innerHTML+=contentmusic;
        var del=document.getElementById("trtop_"+id);
        del.parentNode.removeChild(del);
        for(var i=0;i<musics.length;i++){
            if(musics[i]==id){
                musics[i]=undefined;
                create_top();
                break;
            }
        }

    }
    function topup(id){

        //alert(document.getElementById("trtop_"+id).id+":id");
        for(var i=0;i<musics.length;i++){
            if(musics[i]==id && i>0){
                var j=1;
                while(musics[i-j]==undefined && i-j>=0){

                    j++;
                }

                var contenttmp=document.getElementById("trtop_"+musics[i]).innerHTML;
//                var contenttmp2=document.getElementById("trtop_"+musics[i-j]);
//                var pct=contenttmp.parentNode;
//                pct.replaceChild(contenttmp,contenttmp2);
//                pct.replaceChild(contenttmp2,contenttmp);
                document.getElementById("trtop_"+musics[i]).innerHTML=document.getElementById("trtop_"+musics[i-j]).innerHTML;;
                document.getElementById("trtop_"+musics[i-j]).innerHTML=contenttmp;

                var idtmptr=document.getElementById("trtop_"+musics[i]).id;
                var idtmptr2=document.getElementById("trtop_"+musics[i-j]).id;
                document.getElementById("trtop_"+musics[i]).id=document.getElementById("trtop_"+musics[i]).id+"abc123";
                document.getElementById("trtop_"+musics[i-j]).id=idtmptr;
                document.getElementById("trtop_"+musics[i]+"abc123").id=idtmptr2

                //hoan vi 2 element
                var tmp=musics[i];
                musics[i]=musics[i-j];
                musics[i-j]=tmp;

                //document.getElementById("kqkq").innerHTML=musics;
                create_top();
                //alert(musics);
                break;
            }
        }

    }
    function topdown(id){
        //alert(document.getElementById("trtop_"+id).id+":id");
        for(var i=0;i<musics.length;i++){
            if(musics[i]==id){
                var j=1;
                while(musics[i+j]==undefined && i+j<musics.length){

                    j++;
                }
                if(musics[i+j]==undefined){ return;}
                //alert(musics[i]+":"+musics[i+j]);



                var contenttmpdown=document.getElementById("trtop_"+musics[i]).innerHTML;
                document.getElementById("trtop_"+musics[i]).innerHTML=document.getElementById("trtop_"+musics[i+j]).innerHTML;
                document.getElementById("trtop_"+musics[i+j]).innerHTML=contenttmpdown;
                //alert(document.getElementById("trtop_"+musics[i+j]).id);

                var idtmptr=document.getElementById("trtop_"+musics[i]).id;
                var idtmptr2=document.getElementById("trtop_"+musics[i+j]).id;
                document.getElementById("trtop_"+musics[i]).id=document.getElementById("trtop_"+musics[i]).id+"abc123";
                document.getElementById("trtop_"+musics[i+j]).id=idtmptr;
                document.getElementById("trtop_"+musics[i]+"abc123").id=idtmptr2;

                //hoan vi 2 element
                var tmp=musics[i];
                musics[i]=musics[i+j];
                musics[i+j]=tmp;

                //document.getElementById("kqkq").innerHTML=musics;
                create_top();
                //alert(musics);
                break;
            }
        }

    }
    function save(){

        var top=";";
        for(var i=0;i<musics.length;i++){
            if(musics[i]!=undefined){
                top+=musics[i]+";";
            }
        }
        //if(top==";"){return;}
		//alert(top);
        //
		//document.getElementById( "JO_integration_asynchronous" ).src = "JO_05_execution.php?JO_query=SaveTopArtist&top="+top+"&artist=<?=$artistid?>";
		location = "JO_05_execution.php?JO_query=SaveTopArtist&top="+top+"&artist=<?=$artistid?>";
    }
    function create_top()
    {
        var ntop=1;
        for(var i=0;i<musics.length;i++){
            if(musics[i]!=undefined){
                document.getElementById("tdtopid_"+musics[i]).innerHTML=ntop;
                ntop++;
            }
        }
    }
    function changeartist(c){
        location="JO_00_integration.php?JO_unit=31_Artist&artistid="+c.value+"&searchkey=<?=urlencode($searchkeyartist)?>";
    }
    function searchfocus(v){
        if(v.value=="<?=$JO["JO_searchid"]?>")
            v.value="";
    }
    function searchblur(v){
        var s=v.value;
        //Cắt bỏ những khoảng trắng đầu chuỗi
        while(s.charCodeAt(0)==32)
            s=s.substring(1);
        //Cắt bỏ những khoảng trắng cuối chuỗi
        while(s.charCodeAt(s.length-1)==32)
            s=s.substring(0,s.length-1);
        if(s=="")
            v.value="<?=$JO["JO_searchid"]?>";
        else
            v.value=s;
    }
    window.onload = function() {
        document.getElementById("txtsearchartist").focus();
    }
    function searchKeyPress(e)
    {
        // look for window.event in case event isn't passed in
        if (window.event) { e = window.event; }
        if (e.keyCode == 13)
        {
            key=document.getElementById("txtsearchartist").value;
            if(key=="<?=$JO["JO_searchid"]?>" || key==""){

                location=("JO_00_integration.php?JO_unit=31_Artist");
            }else{

                location=("JO_00_integration.php?JO_unit=31_Artist&searchkey="+document.getElementById("txtsearchartist").value);
            }

        }
    }
    function sendurl(p){
            <?
            if($searchkeyartist==$JO["JO_searchid"]){
              ?>
                location=("JO_00_integration.php?JO_unit=61_Rbt&key="+p);
                <?
            }else{
                ?>
                location=("JO_00_integration.php?JO_unit=61_Rbt&key="+p+"&searchkey=<?=urlencode($searchkeyartist)?>");
                <?
            }
            ?>

    }
    function sendurl2(p){
            <?
            if($searchkeyartist==$JO["JO_searchid"]){
              ?>
                location=("JO_00_integration.php?JO_unit=31_Artist&Page=<?=$page?>&artistid="+p);
                <?
            }else{
                ?>
                        location=("JO_00_integration.php?JO_unit=31_Artist&Page=<?=$page?>&artistid="+p+"&searchkey=<?=  urlencode($searchkeyartist)?>");
                <?
            }
            ?>

    }
 </script>
</div>